public class Demo10 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            for(int i = 0; i < 5; i++)
            {
                System.out.println("t 线程工作中!");
                try{
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        t.start();

        //在a中用b调用join后a就会等待b
        System.out.println("join 等待开始");
        t.join();
        System.out.println("join 等待结束");
    }
}
